#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{   
    int g,s,k;
    int g1,s1,k1,g2,s2,k2;
    scanf("%d.%d.%d %d.%d.%d",&g1,&s1,&k1,&g2,&s2,&k2);
    k = k1 + k2;
    s = s1 + s2;
    g = g1 + g2;
    if(k >= 29)
    {
        k = k % 29;
        s ++;
    }
    if(s >= 17)
    {
        s = s % 17;
        g ++;
    }
    printf("%d.%d.%d",g,s,k);
    return 0;
}